package thread;
//守护线程
public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread rose = new Thread() {
            public void run() {
                System.out.println("rose:let me go!");
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                }
                System.out.println("rose:aaaaaaaaaaaaaaaaaaaaaaa");
                System.out.println("pow!");
            }
        };

        Thread jack = new Thread(){

            public void run(){
                while (true) {
                    System.out.println("jack:you jump i jump!");

                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }
                }
            }
        };
        rose.start();
        jack.setDaemon(true);//设置守护线程需要在线程启动前进行
        jack.start();
    }
}
